<!--问答页面-->

<template>
  <div class="BaCol">
    <div class="main" v-for="(item,index) in questions" :key="index" @click="gotoAns(item)">
      <div class="img">
        <img :src="item.userImg">
      </div>
      <div class="item one">
        <span>{{ item.username }}</span>
        <span>近一天观看 576</span>
        <span>{{ item.solve }}</span>
      </div>
      <div class="item two">
        <span>{{ item.questitle}}</span>
        <span>{{item.labelone}}</span>
        <span>{{item.labeltwo}}</span>
        <span>{{item.labelthree}}</span>
      </div>
<!--      <div class="item">-->
<!--        <span>1174 赞同</span>-->
<!--        <span>90 评论</span>-->
<!--        <span>10-01</span>-->
<!--      </div>-->
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: "Channel",
  data() {
    return {
      index: '',
      content: '中国',
      questions:{

      }
    }
  },
  methods: {

    gotoAns(index){
      this.$router.push('/futext')
      console.log(index)
      sessionStorage.setItem('ques',JSON.stringify(index))
    },
    getquestion(){
      let ques=sessionStorage.getItem('channel')
      let label='';
      if (ques!=null){
        label = ques;
      }
      axios.post("http://localhost:9999/question",{params:label}).then((res)=>{
        this.questions=res.data.data;
      })
    }
  },
  created() {
    this.getquestion()
  }
}
</script>

<style scoped>


.BaCol {
  position: absolute;
  top: 61px;
  left: 25px;
  background-color: #f7f7f7;
}

.main {
  margin-top: 10px;
  background-color: white;
  border-radius: 20px;
  min-width: 400px;
}

.main .img {
  display: inline;
}

.main .img img {
  height: 50px;
  width: 50px;
  border-radius: 50%;
}

.main .one {
  display: inline;
}

.main .one span:nth-child(1) {
  color: black;
  font-weight: bold;
  position: absolute;
  margin: 0;
  font-size: 20px;

}

.main .one span:nth-child(2) {
  color: #c3c3c3;
  font-size: 15px;
}

.main .one span:nth-child(3) {
  color: skyblue;
  position: absolute;
  right: 10px;
}

.main .two span:nth-child(1) {
  display:block;
  font-weight: bold;
  font-size: 18px;
  color: black;
}

/*.main .two span:nth-child(2) {*/
/*  font-weight: bold;*/
/*  font-size: 18px;*/
/*  color: #cccccc;*/
/*}*/

/*.main .two span:nth-child(3) {*/
/*  display: inline-block;*/
/*  font-size: 15px;*/
/*  color: #cccccc;*/
/*  width: 300px;*/
/*  overflow: hidden;*/
/*  white-space: nowrap;*/
/*  text-overflow: ellipsis;*/
/*  vertical-align: text-bottom;*/
/*}*/
.main .two span:nth-child(2),
.main .two span:nth-child(3),
.main .two span:nth-child(4){
  font-size: 10px;
  color: #00965e;
  background-color: rgba(0,150,94,.1);
  margin-right: 5px;
  /*float: right;*/
  margin-top: 30px;
}
</style>